package com.cgydu.dao;

import com.cgydu.entity.User;

import java.sql.SQLException;

/**
 * projectName: day25_store
 * author: CGY
 * time: 2020/8/26 11:30
 * description:用户的数据库访问对象
 */
public interface UserDao {
    /**
     * 判断账号是否存在！
     * @param username
     * @return 存在的数量
     */
    Long queryUserNameExist(String username) throws SQLException;

    /**
     * 用户插入数据库
     * @param user
     * @return
     */
    int insertUser(User user) throws SQLException;

    /**
     * 数据库code更新
     * @param code
     * @param activeCode
     * @return
     */
    int updateUserCode(String code, int activeCode) throws SQLException;

    /**
     * code查询用户
     * @param code
     * @return
     */
    long queryUserByCode(String code) throws SQLException;

    /**
     * 置空激活码
     * @param code
     */
    void updateUserCodeToNull(String code) throws SQLException;

    User queryUser(String username, String password)throws SQLException;
}
